/**
 * Created by Dzl on 2017-1-24.
 */

// exports.list = function* newsList() {
//     const dataList = {
//         list:[
//             { id: 1, title: 'this is news 1', url: '/news/1' },
//             { id: 2, title: 'this is news 2', url: '/news/2' }
//         ]
//     };
//     yield this.render('news/list.tpl',dataList);
// }

exports.list = function* newsList() {
    const page = this.query.page || 1;
    const newsList = yield this.service.news.list(page);
    yield this.render('news/list.tpl',{list: newsList});
}

exports.index = function* () {
    const page = this.query.page || 1;
    const newsList = yield this.service.news.list(page);

    yield this.render('news/index.html',{
        title: 'news index',
        list: newsList
    });
}